function reactive(target) {
    return createReactiveObject(target)
}
function isObject(target) {
    return typeof target === 'object' && target !== null
}
function createReactiveObject(target) {
    if (!isObject(target)) return target
    const handlers = {
        get(target, key, receiver) {
            console.log('get');
            let res = Reflect.get(target, key, receiver)
            return isObject(res) ? reactive(res) : res
        },
        set(target, key, val, receiver) {
            console.log('set');
            let res = Reflect.set(target, key, val, receiver)
            return res
        }
    }
    const observed = new Proxy(target, handlers)
    return observed
}
let obj = {
    key: '100',
    objKey: {
        age: 18
    }
}
let p = reactive(obj)
// console.log(p.key);
console.log(p.objKey.age);
p.objKey.age = 100